<?php
/**
*	作者：信呼开发团队(雨中磐石)
*	官网：http://www.rockoa.com
*	软件：REIM即时通信平台
*	用户信息
*/
class companyClassModel extends Model
{
	public $deflogo = 'images/nologo.png';
	
	public function getCreate($uid=0)
	{
		if($uid==0)$uid = $this->adminid;
		$rows = $this->getall('uid='.$uid.'','*','id desc');
		foreach($rows as $k=>$rs)$rows[$k]['logo'] = getface($rs['logo'], $this->deflogo);
		return $rows;
	}
	
	public function getXinxi($id,$fields='*')
	{
		$rs = parent::getXinxi($id,$fields);
		$logo = getface($rs['logo'], $this->deflogo);
		$rs['logo'] = $logo;
		return $rs;
	}
	
	/**
	*	获取
	*/
	public function getJoin($urs)
	{
		$uid 	= $urs['id'];
		$mobile = $urs['mobile'];
		$where  = 'a.`uid`='.$uid.'';
		if(!isempt($mobile))$where="($where) or (a.`mobile`='$mobile' and a.`status`=0)";
		
		$sql 	= 'select b.logo,b.num,b.name,b.id,a.status,a.id as aid,b.shortname from `[Q]usera` a left join `[Q]company` b on a.cid=b.id where ('.$where.')';
		
		$rows = $this->db->getall($sql);
		foreach($rows as $k=>$rs)$rows[$k]['logo'] = getface($rs['logo'], $this->deflogo);
		
		return $rows;
	}
}